package game.connection;
import game.Field;
import game.Player;

import java.io.Serializable;
import java.util.Map;
import java.util.Observable;

/**
 * This is just the message for INITIATE the game.
 * @author Sarun Wongtanakarn 5510546166
 * @author Apiwat Jierakulpanit 5510546212
 * @Version 2013.04.26
 */
public class GameInitiate extends Observable implements Serializable, Package {
	
	public final Player PLAYER;
	public final Field FIELD;
	public final int MAXIMUM_PLAYER;
	public final int INTERVAL;
	public final Map<Integer, String> PLAYER_NAMES;

	public GameInitiate(Field field, Player player, int maxPlayer, int interval, Map<Integer, String> names) {
		FIELD = field;
		PLAYER = player;
		MAXIMUM_PLAYER = maxPlayer;
		INTERVAL = interval;
		PLAYER_NAMES = names;
	}
	
	public void update() {
		setChanged();
		notifyObservers();
	}

	@Override
	public Object unpack() {
		return this;
	}

	@Override
	public PackageType getType() {
		return PackageType.GAME_INITIATE;
	}

}
